/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.dengues.model.component.util;

import java.util.List;

import org.dengues.model.component.*;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;

/**
 * <!-- begin-user-doc -->
 * The <b>Switch</b> for the model's inheritance hierarchy.
 * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
 * to invoke the <code>caseXXX</code> method for each class of the model,
 * starting with the actual class of the object
 * and proceeding up the inheritance hierarchy
 * until a non-null result is returned,
 * which is the result of the switch.
 * <!-- end-user-doc -->
 * @see org.dengues.model.component.ComponentPackage
 * @generated
 */
public class ComponentSwitch<T> {
    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public static final String copyright = "// ============================================================================\r\n//\r\n// Copyright (C) 2006-2007 Dengues\r\n//\r\n// Google Group: http://groups.google.com/group/dengues\r\n// QQ Group: 24885404\r\n//\r\n// This library is free software; you can redistribute it and/or\r\n// modify it under the terms of the GNU Lesser General Public\r\n// License as published by the Free Software Foundation; either\r\n// version 2.1 of the License.\r\n//\r\n// This library is distributed in the hope that it will be useful,\r\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r\n// Lesser General Public License for more details.\r\n//\r\n// You should have received a copy of the GNU General Public License\r\n// along with this program; if not, write to the Free Software\r\n// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r\n//\r\n// ============================================================================\r\n";
    /**
     * The cached model package
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    protected static ComponentPackage modelPackage;

    /**
     * Creates an instance of the switch.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public ComponentSwitch() {
        if (modelPackage == null) {
            modelPackage = ComponentPackage.eINSTANCE;
        }
    }

    /**
     * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @return the first non-null result returned by a <code>caseXXX</code> call.
     * @generated
     */
    public T doSwitch(EObject theEObject) {
        return doSwitch(theEObject.eClass(), theEObject);
    }

    /**
     * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @return the first non-null result returned by a <code>caseXXX</code> call.
     * @generated
     */
    protected T doSwitch(EClass theEClass, EObject theEObject) {
        if (theEClass.eContainer() == modelPackage) {
            return doSwitch(theEClass.getClassifierID(), theEObject);
        }
        else {
            List<EClass> eSuperTypes = theEClass.getESuperTypes();
            return
                eSuperTypes.isEmpty() ?
                    defaultCase(theEObject) :
                    doSwitch(eSuperTypes.get(0), theEObject);
        }
    }

    /**
     * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @return the first non-null result returned by a <code>caseXXX</code> call.
     * @generated
     */
    protected T doSwitch(int classifierID, EObject theEObject) {
        switch (classifierID) {
            case ComponentPackage.COLMUN_TYPE: {
                COLMUNType colmunType = (COLMUNType)theEObject;
                T result = caseCOLMUNType(colmunType);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case ComponentPackage.COMPONENT_TYPE: {
                COMPONENTType componentType = (COMPONENTType)theEObject;
                T result = caseCOMPONENTType(componentType);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case ComponentPackage.CONNECTIONS_TYPE: {
                CONNECTIONSType connectionsType = (CONNECTIONSType)theEObject;
                T result = caseCONNECTIONSType(connectionsType);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case ComponentPackage.CONNECTION_TYPE: {
                CONNECTIONType connectionType = (CONNECTIONType)theEObject;
                T result = caseCONNECTIONType(connectionType);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case ComponentPackage.DOCUMENT_ROOT: {
                DocumentRoot documentRoot = (DocumentRoot)theEObject;
                T result = caseDocumentRoot(documentRoot);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case ComponentPackage.HEADER_TYPE: {
                HEADERType headerType = (HEADERType)theEObject;
                T result = caseHEADERType(headerType);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case ComponentPackage.IMPORTS_TYPE: {
                IMPORTSType importsType = (IMPORTSType)theEObject;
                T result = caseIMPORTSType(importsType);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case ComponentPackage.IMPORT_TYPE: {
                IMPORTType importType = (IMPORTType)theEObject;
                T result = caseIMPORTType(importType);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case ComponentPackage.ITEMS_TYPE: {
                ITEMSType itemsType = (ITEMSType)theEObject;
                T result = caseITEMSType(itemsType);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case ComponentPackage.ITEM_TYPE: {
                ITEMType itemType = (ITEMType)theEObject;
                T result = caseITEMType(itemType);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case ComponentPackage.PARAMETERS_TYPE: {
                PARAMETERSType parametersType = (PARAMETERSType)theEObject;
                T result = casePARAMETERSType(parametersType);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case ComponentPackage.PARAMETER_TYPE: {
                PARAMETERType parameterType = (PARAMETERType)theEObject;
                T result = casePARAMETERType(parameterType);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case ComponentPackage.RETURNS_TYPE: {
                RETURNSType returnsType = (RETURNSType)theEObject;
                T result = caseRETURNSType(returnsType);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case ComponentPackage.RETURN_TYPE: {
                RETURNType returnType = (RETURNType)theEObject;
                T result = caseRETURNType(returnType);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            default: return defaultCase(theEObject);
        }
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>COLMUN Type</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>COLMUN Type</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseCOLMUNType(COLMUNType object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>COMPONENT Type</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>COMPONENT Type</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseCOMPONENTType(COMPONENTType object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>CONNECTIONS Type</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>CONNECTIONS Type</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseCONNECTIONSType(CONNECTIONSType object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>CONNECTION Type</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>CONNECTION Type</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseCONNECTIONType(CONNECTIONType object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Document Root</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Document Root</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseDocumentRoot(DocumentRoot object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>HEADER Type</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>HEADER Type</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseHEADERType(HEADERType object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>IMPORTS Type</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>IMPORTS Type</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseIMPORTSType(IMPORTSType object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>IMPORT Type</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>IMPORT Type</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseIMPORTType(IMPORTType object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>ITEMS Type</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>ITEMS Type</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseITEMSType(ITEMSType object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>ITEM Type</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>ITEM Type</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseITEMType(ITEMType object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>PARAMETERS Type</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>PARAMETERS Type</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T casePARAMETERSType(PARAMETERSType object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>PARAMETER Type</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>PARAMETER Type</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T casePARAMETERType(PARAMETERType object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>RETURNS Type</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>RETURNS Type</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseRETURNSType(RETURNSType object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>RETURN Type</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>RETURN Type</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseRETURNType(RETURNType object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch, but this is the last case anyway.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject)
     * @generated
     */
    public T defaultCase(EObject object) {
        return null;
    }

} //ComponentSwitch
